import request from '@/utils/request'
// @baseUrl = 'http://localhost:9999/cz-system/api/v1'
// @baseUrl = 'http://47.122.3.254:9999/cz-system/api/v1'

const baseUrl = '/cz-system/api/v1' //企业管理
// 查询企业详情
export const companyInfo = (data: any) => {
    return request({
        url: baseUrl + '/company/' + data,
        method: 'GET',
        data: data
    })
}

//新增用户
 // # username:登录账号
    // # password:密码
    // # nickname:姓名
    // # mobile:手机号
    // # email:邮件
    // # roleId:角色Id,多个角色用英文逗号分割
    // # userType:用户类型 默认
    // # deptName:部门
    // # workPosition:职位
    // # smsCode:手机验证码
    // # emailCode:邮箱验证码
export const addUser = (data: any) => {
    return request({
        url: baseUrl + '/users/addUser',
        method: 'POST',
        data: data
    })
}
// 查询角色权限枚举
export const getRolePermission = (data: any) => {
    return request({
        url: baseUrl + '/roles/list',
        method: 'POST',
        data: data
    })
}

// 新增用户获取手机验证码
export const getPhoneCode = (param: any) => {
    return request({
        url: baseUrl + '/users/register/sms_code',
        method: 'POST',
        params: param

    })
}
// 新增用户获取邮箱验证码
export const getEmailCode = (data: any) => {
    return request({
        url: baseUrl + '/users/register/email_code?email='+data,
        method: 'POST'
    })
}
// 查询用户分页列表
export const getUserPage = (data: any) => {
    return request({
        url: baseUrl + '/users/userPage',
        method: 'POST',
        data: data
    })
}
//查询用户分页列表
export const getUserSimpleList = (data: any) => {
    return request({
        url: baseUrl + '/users/userSimpleList',
        method: 'POST',
        data: data
    })
}
// 修改用户状态
export const modifyStatus = (userId:string ,data:string) =>{
    return request({
        url: baseUrl + '/users/'+ userId + '/status?status='+ data,
        method: 'put',
        data: data
    })
}
// 删除用户
export const deleteUser = (data: any) => {
    return request({
        url: baseUrl + '/users/'+data,
        method: 'DELETE',
        data: data
    })
}

// 企业信息分页列表
export const getSysCompanyPage = (data:any) =>{
    return request({
        url: baseUrl + '/company/getSysCompanyPage',
        method: 'POST',
        data:data
    })
}  

// 平台方用户权限相关接口


// 平台方查询企业用户列表
export const getCompanyPage = (data: any) => { 
    return request({
        url: baseUrl + '/platforms/getSysCompanyPage',
        method: 'POST',
        data:data
    })
}
// 更新企业账号审核状态
export const updateSysCompanyExamineStatus = (data: any) => {
    return request({
        url: baseUrl + '/platforms/updateSysCompanyExamineStatus',
        method: 'PUT',
        data: data
    })
}
// 获取平台方用户列表
export const getUserList = (data:any) =>{
    return request({
        url: baseUrl + '/users/userPage',
        method: 'POST',
        data:data
    })
}
export const getUserListPlatforms = (data: any) => {
    return request({
        url: baseUrl + '/platforms/userPage',
        method: 'POST',
        data: data
    })
}
//查询单个详情
export const getRoleDetailById = (id: any) => {
  return request({
    url: baseUrl + '/platforms/user/' + id,
    method: 'GET'
  })
}
// 删除用户账号
export const delUser = (data:any) =>{
    return request({
        url: baseUrl + '/platforms/'+data,
        method: 'DELETE',
        data:data
    })
}
// 用户账号启用和停用 (1:正常 0:禁用
export const userStatus = (userId: string, data: string) =>{
    return request({
        url: baseUrl + '/platforms/' + userId + '/status?status='+data,
        method: 'PUT',
        data:data
    })
}
// 更新用户认证状态
export const updateSysUserExamineStatus = (data: any) =>{
    return request({
        url: baseUrl + '/platforms/updateSysUserExamineStatus',
        method: 'PUT',
        data:data
    })
}

// 修改用户角色权限
export const updateSysUserRole = (data: any) => {
    return request({
        url: baseUrl + '/platforms/updateUserRole',
        method: 'PUT',
        data:data
    })
}


// 个人资料 保存信息

export const saveUserInfo = (data: any) => {
    return request({
        url: baseUrl + '/users/updateUserInfo',
        method: 'PUT',
        data:data
    })
}